﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.IO;

namespace intelliSys.Management.Automation.Profiler
{
    class DBSwitchTask
    {
        public static void SwitchDB()
        {
            _switch();
        }
        public static void UnswitchDB(Application app)
        {
            _switch();
        }
        static void _switch()
        {
            var directory = Directory.GetCurrentDirectory() + "\\";
            try
            {
                File.Copy(directory + "intelliPaper.DB.dll", directory + "tempDB.db",true);
                File.Copy(directory + "intelliPaper.DB1.dll", directory + "intelliPaper.DB.dll",true);
                File.Copy(directory + "tempDB.db", directory + "intelliPaper.DB.dll",true);
            }
            catch(Exception ex)
            {
               MessageBox.Show(ex.Message, "DB SwitchFailed", MessageBoxButton.OK);
            }
        }
    }
}
